#ifndef MBUTTON_H
#define MBUTTON_H

#include <QPushButton>
#include <QMouseEvent>

namespace Ui {
class MButton;
}

typedef enum{
    HTTP,
    TOOL,
    AI,
    OTHER
}BUTTON_TYPE;

class MButton : public QPushButton
{
    Q_OBJECT

public:
    explicit MButton(QWidget *parent = nullptr);
    ~MButton();

//    void set_butt_Information(BUTTON_TYPE type,QString name,QString path);
    void set_butt_Information(BUTTON_TYPE type,QString name,QString path,QIcon icon = QIcon());
    void set_isnull(bool is_null);
    void set_iconpath(QString path);
    void set_filename(QString name);
    void set_filepath(QString path);
    bool get_isnull();

    uint8_t get_buttname();
    QString get_filename();
    QString get_filepath();
    QString get_iconpath();

private:
    Ui::MButton *ui;

    uint8_t buttmode;
    QString filename;
    QString filepath;
    QString iconpath;
    bool isnull;

    void mousePressEvent(QMouseEvent *event) override {
        if(event->button() == Qt::RightButton){
            emit right_clicked_button(this);
        }else if(event->button() == Qt::LeftButton){
            emit clicked_button(this);
        }else{}
    }

signals:
    void clicked_button(MButton *butt);

    void right_clicked_button(MButton *butt);

};

#endif // MBUTTON_H
